Parallel processing of video frames during video encoding

ABSTRACT

Disclosed are techniques for compressing data of an image. Intermediate pixels may be determined. Each location of the image may be associated with a block of a plurality of blocks of a first size and a block of a plurality of blocks of a second size. For each block of the first size and of the second size, a first cost for a first mode and a second cost for a second mode may be determined in parallel using the intermediate pixels. A final mode and a final block size may be selected for each location of the image using the first cost and the second cost for each of a respective block of the first size and a respective block of the second size associated with a corresponding location. Final pixels may be determined, and a representation of the image may be obtained based on the final pixels.

RELATED APPLICATIONS

This application claims the benefit of priority under 35 U.S.C. 365 to the international application PCT/CN2021/116311, filed Sep. 2, 2021 with the China National Intellectual Property Administration, which is hereby incorporated in its entirety.

TECHNICAL FIELD

At least one embodiment pertains to computational technologies used to perform and facilitate efficient compression of video files. For example, at least one embodiment pertains to operations utilized by video codec software for efficient encoding of high-definition video files using modern video encoding standards that, while offering a large variety of tools and options that enhance video quality, come at the cost of increased computational complexity.

BACKGROUND

A video file in a raw (source) pixel format can occupy a very large memory space and requires a large network bandwidth, which can be impractical for storage and/or livestreaming. For example, a typical high-definition video displays about 30 frames per second, which are typically rather similar to each other. A lot of information in such frames is necessarily redundant, allowing efficient compression. On one hand, relatively minor changes occur between subsequent frames (temporal redundancy). On the other hand, various regions in a given frame are often similar to each other (spatial redundancy), e.g., an image of the sky can extend over a large portion of a frame. As a result, in lieu of transmitting the actual pixel information (luminance and chromaticity) of each pixel, a codec can identify a reference block that is similar to the block being encoded (“predicted”) and provide to a decoder a suitable and compact mathematical representation of the difference (“delta”) between the actual source block and the predicted block. The reference block can be a block of a different (e.g., previous, or even subsequent) frame, a block of the same frame, or even a synthetic block generated according to some predetermined scheme (mode) based on a small number of reference pixels. Subsequently, instead of storing or livestreaming the actual frame of pixels, the codec can output a bit stream of encoded data, which largely contains instructions to the decoder about how to generate an approximation of the frame whose visual appearance is indistinguishable or very similar to the source frame.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a schematic block diagram of an example computing device that may implement the disclosed methods for efficient encoding operations, in accordance with at least some embodiments.

FIG. 2A is a schematic diagram depicting operations of a sequential processing of a codec system used for efficient encoding operations, in accordance with at least some embodiments.

FIG. 2B is a schematic diagram depicting operations of another possible sequential processing of a codec system used for efficient encoding operations, in accordance with at least some embodiments.

FIG. 3A is a flow diagram of an example method of parallel processing of a video frame during video encoding for efficient encoding operations, in accordance with at least some embodiments.

FIG. 3B is a flow diagram of an example method of determining intermediate pixels for use in parallel processing of a video frame during video encoding for efficient encoding operations, in accordance with at least some embodiments.

FIG. 4 illustrates an example machine in the form of a computer system within which a set of instructions, for causing the machine to perform any one or more of the methodologies discussed herein, may be executed.

DETAILED DESCRIPTION

Video codecs allow digital video files to be compressed in order to reduce the amount of storage space and bandwidth required to store and transmit the file. The compressed video file may appear very similar to or indistinguishable from the source video file when it is uncompressed and displayed. In order to compress the digital video file, the codec divides each frame of the video into a series of blocks. For each block, the codec determines the best size and the best mode to use for compression. The codec may determine to use an intra-prediction mode or an inter-prediction mode. Then, for each block, after making a size selection and a mode selection, the codec will compare the prediction to the source pixels, calculate the difference (or residual), and encode the prediction size, prediction mode, and the residual pixel values in an output bitstream. A single frame may be divided into blocks of multiple sizes, and each block may have a unique prediction mode. A subsequent frame may be divided into blocks of different sizes, and each block may have a prediction mode that is different from the prediction modes of the blocks of the previous frame. The codec processes each frame individually and tries to minimize the cost of encoding the frame.

Each pixel value of the frame may include multiple components, such as a luma component, indicating brightness or intensity of the pixel, and a chroma component, indicating one or more colors of the pixel (e.g., Red, Green, Blue chromaticity values, or any other suitable color values).

An intra-predicted block may use reference pixel values from neighboring blocks to approximate the pixel values of the source block. For example, the pixel values of an intra-predicted block may be based on pixel values from the bottom boundary of the block above it, pixel values from the right boundary of the block to the left of it, a pixel value from the bottom-right corner of the block to the top-left of it, or a combination of these pixel values. Intra-prediction modes are effective in regions of a video frame with similar colors across many blocks (e.g., a blue sky).

An inter-predicted block may use pixel values from a previous frame or a subsequent frame (herein referred to as a reference frame) to approximate the pixel values of the source block. This is effective for moving objects in the video. As the object moves, the object in the current frame may appear similar or identical to the object in the reference frame, but the object may be in a new position. The codec can use the same pixel values from the object in the reference frame to approximate the pixel values of the object in the current frame. Because the codec uses the same pixel values from the reference frame and does not need to create a new set of pixel values for the inter-predicted block, inter-predicted blocks result in a higher compression rate than intra-predicted blocks.

There are various video codec standards that have been defined, such as H.264 (Advanced Video Coding or AVC), H.265 (High Efficiency Video Coding or HEVC), H.266 (Versatile Video Coding or VVC), VP9, and AV1 (AOMedia Video 1). Each standard defines the set of inter-prediction modes and the set of intra-prediction modes that are acceptable. Each standard also defines the set of block sizes that are acceptable. For example, AV1 allows for 58 intra-frame prediction modes, multiple inter-frame prediction modes, and a variety of block sizes, including square blocks 8×8, 16×16, 32×32, 64×64, 128×128, and rectangular blocks 64×32, 32×64, 32×16, 16×32, 16×8, 8×16.

A standard video codec starts in the top-left corner of a frame, evaluates the cost of all possible combinations of block sizes and prediction modes (both intra-prediction modes and inter-prediction modes), makes a selection based on the calculated costs, and proceeds to the next block (e.g., the block to the right of the top-left block). Because the intra-prediction modes use pixel values from neighboring blocks, each block needs to be processed sequentially, in order to ensure that the neighboring blocks have been processed already and have reference pixels available for processing of the current block. Thus, there is a dependency between each block and the previous block. Processing blocks sequentially slows down the encoding process, as only a single block can be processed at a time, even if additional computing resources are not being used. Additionally, because there are so many possible combinations of block sizes and prediction modes that need to be considered, processing even a single block may take a substantial time.

Aspects and embodiments of the present disclosure address these and other technological challenges of real-time video encoding in modern advanced codecs by reducing dependencies encountered in the encoding process. In some embodiments, dependencies are reduced by performing an initial sequential processing of the blocks of a video frame, to create a set of intermediate pixels, followed by parallel processing of the blocks of the video frame. For example, the initial sequential processing may be performed for blocks of one size (e.g., 16×16 pixels) and evaluated using intra-prediction modes when generating an approximation for each block as described above, thus reducing the number of combinations of block sizes and prediction modes that need to be considered for each block. Then, using the generated intermediate pixels as reference pixels, the remaining combinations of block sizes and prediction modes can be evaluated for each block in parallel to select a final block size and final prediction mode for each block of the video frame. After a final block size and final prediction mode has been selected for each block of the video frame, the codec sequentially calculates and encodes, for each block, the final residual along with the final prediction size and final prediction mode. Advantages of the disclosed embodiments over the existing technology include significant acceleration of the encoding process. Both the initial and the final sequential processing stages may be performed much faster than done conventionally: the initial sequential processing is limited to a much smaller number of fixed block sizes (e.g., one) while the final sequential processing is limited to the selected final size and the selected final mode for each block.

System Architecture

FIG. 1 is a schematic block diagram of an example computing device 100 that may implement the disclosed methods for efficient encoding operations, in accordance with at least some embodiments. The computing device 100 may include one or more devices, modules, and/or applications that interact with a video encoder 105, such as a camera 101, a video editing software 102, an internet browser 103, and/or a media playback software 104, and the like. The video encoder 105 may perform at least some aspects of the present disclosure. The video encoder 105 may include a reference pixel module 106, a block prediction module 107, a cost function module 110, a compression module 111, and a memory 112. The block prediction module 107 may have an intra-prediction sub-module 108 and an inter-prediction sub-module 109.

The reference pixel module 106 may store the predicted block pixel values in the memory 112 as such values are created. The reference pixel module 106 may also retrieve from the memory 112 the reference pixel values that are used for approximating block(s) currently being processed by the video encoder 105. For example, the reference pixel module 106 may retrieve from the memory 112 a subset of the computed pixel values of the blocks to the top, to the left, and to the top-left of the block(s) currently being processed for use in calculating the cost of one or more intra-prediction modes. The reference pixel module 106 may also retrieve from the memory 112 computed pixel values of a block from an already processed previous frame or subsequent frame that corresponds to the block(s) currently being processed, for use in calculating the cost of one or more inter-prediction modes. Since inter-prediction modes are often used for moving objects, the reference pixel module 106 may retrieve pixel values, from a previously processed frame, e.g., from a block that neighbors the current block. For example, the reference pixel module 106 may retrieve from the memory 112 computed pixel values from a previously processed frame of a block that is to the right of the block currently being processed.

The block prediction module 107 may use the reference pixel values from the reference pixel module 106 when calculating predictions for each block. The intra-prediction sub-module 108 may be used for making intra-frame predictions, and the inter-prediction sub-module 109 may be used for making inter-frame predictions. The block prediction module 107 may be used during the initial sequential processing, the parallel processing, and the final sequential processing described above. In some instances, the block prediction module 107 may use one of the sub-modules to create a block prediction. For example, during the initial sequential processing, the block prediction module 107 may calculate intra-frame predictions and may use the intra-prediction sub-module 108 but not the inter-prediction sub-module 109, whereas during the parallel processing, the block prediction module 107 may use both the intra-prediction sub-module 108 and the inter-prediction sub-module 109.

When creating an intra-frame predicted block, the intra-prediction sub-module 108 may use reference pixel values from the reference pixel module 106, as described above. The reference pixel values may be from one or more blocks that neighbor the current block. Based on the intra-prediction mode that is used, the intra-frame predicted block created by the intra-prediction sub-module 108 may have different pixel values. For example, the intra-prediction mode may be a vertical mode, such that the predicted block has pixel values obtained from a top neighboring block. Alternatively, the intra-prediction mode may be a horizontal mode, such that the predicted block has pixel values obtained from a left neighboring block. As another example, the intra-prediction mode may use a different direction (e.g., at some oblique angle to the horizontal direction), such that the predicted block has a combination of pixel values from multiple neighboring blocks.

When creating an inter-frame predicted block, the inter-prediction sub-module 109 may use reference pixel values from the reference pixel module 106, as described above. The reference pixel values may be from the same block in a previously processed frame or from a block that neighbors the current block in a previously processed frame. In some instances, the reference pixel value may be from a block that is displaced relative to (but partially overlaps with) the current block. As a result, similarly to the intra-prediction blocks, the inter-frame predicted block created by the inter-prediction sub-module 109 may have different pixel values depending on the specific inter-prediction mode that is used.

The block prediction module 107 may generate multiple predictions for a given block. Each prediction may be based on a unique combination of a block size and a prediction mode for the current block. The number of predictions generated for each block may vary between the initial sequential processing, the parallel processing, and the final sequential processing. For example, during the initial sequential processing, each prediction may have the same block size but may have a different intra-prediction mode, whereas during the parallel processing, at least some or even most predictions may have a different size and a different prediction mode (either an intra-prediction or an inter-prediction mode). Each prediction is passed to the cost function module 110 to calculate a corresponding cost.

The cost function module 110 may receive one or more predictions for a block from the block prediction module 107. For each prediction, the pixel values of the predicted block are compared to the pixels values of a corresponding source block of the original video frame being encoded. Various cost functions may be used, including a sum of absolute transformed differences (SATD), a sum of squared differences (SSD), or any other suitable cost function. In some instances, the cost function module 110 may calculate costs using one component of the pixel values during the initial sequential processing and multiple components during the parallel processing. For example, the cost function module 110 may calculate the costs of the intra-frame predictions of the initial sequential processing using the luma component of each pixel value. Then, during the parallel processing, the cost function module 110 may calculate the costs of the block predictions using both the luma component and the chroma component of each pixel value. In another embodiment, the cost function module 110 may calculate the costs of the predictions of both the initial sequential processing and the parallel processing using the luma component of each pixel value and ignoring the chroma component of each pixel value. In another embodiment, the cost function module 110 may calculate the costs of the predictions of both the initial sequential processing and the parallel processing using both the luma component and the chroma component of each pixel value. In some embodiments, the cost function module 110 may weight errors in the representation of the luma component and the chroma component differently, e.g., using empirically selected weights. Furthermore, errors in different colors of the chroma component may be weighed differently from each other, e.g., error in the red color may be weighed more than an error in the blue color (or vice versa).

If the predicted block is substantially different from the corresponding source block, the cost may be high. If the predicted block is substantially similar to the corresponding source block, the cost may be low. The cost function module 110 may select a prediction for the given block based on a comparison of the costs of each of the predictions of the block. In one embodiment, the cost function module 110 may select the prediction with the lowest cost. The selected prediction for a given block may include a block size and a prediction mode.

After a prediction has been selected for a given block, the cost function module 110 may communicate the selection to the block prediction module 107. The block prediction module 107 may then communicate the predicted block that corresponds to the selected prediction to the reference pixel module 106 to be stored in the memory 112 to be used as a reference block for a future block and/or frame. The block prediction module 107 may also communicate the predicted block that corresponds to the selected prediction to the compression module 111.

The compression module 111 may compute the residual, which may be a block of residual pixel values that represent a difference between the pixel values of the predicted block and the pixel values of a corresponding source block. The compression module 111 may then encode the residual pixel values, the prediction block size, and the prediction block mode in an output bitstream, according to the specifications defined in a video codec standard, such as AV1 or any other suitable standard. In some embodiments, the compression module 111 may transform and compress the residual pixel values, according to the specifications defined in a video codec standard, prior to encoding the values in the output bitstream.

FIG. 2A is a schematic diagram depicting operations of a sequential processing 200 of a codec system used for efficient encoding operations, in accordance with at least some embodiments. In some embodiments, the codec system may be the video encoder 105 of FIG. 1 . The sequential processing 200 may be used to generate intermediate pixels 204 for use in a subsequent parallel processing, as described above. The video frame 202 may be partitioned into blocks of a first size (e.g., 16×16 pixel blocks or any other suitable blocks). A first target region indicator 206 (depicted with a dashed box and a first enlarged target region 208) shows a current block 210 (block N) being processed and parts of the blocks that neighbor the current block 210. The blocks above and to the left of the current block 210 in the video frame 202 may have already been sequentially processed and a corresponding block of intermediate pixels may have been generated, as shown by the line-shaded blocks in the video frame 202. Each block of the video frame 202 corresponds to (and approximates) a similarly-located block of source pixels in the original video frame.

During processing of the current block 210, a first set of reference pixels 212 may be selected from the generated intermediate pixels of the blocks neighboring the current block 210. Specifically, the first set of reference pixels 212 may be selected from the generated intermediate pixel blocks to the left, to the top, and to the top-left of the current block 210 (or from any other set of blocks, as may be specified by the codec standard). The set of reference pixels 212 may be combined with each mode 214A-M (Mode 1, Mode 2, . . . , Mode M) of a plurality of modes to create predicted blocks 216A-M (P1, P2, . . . , PM). Each of the predicted blocks 216A-M may then be processed using a cost function 218 to determine a cost 220A-M (Cost 1, Cost 2, . . . , Cost M) for each of the predicted blocks 216A-M. The cost function 218 may compare the predicted block to the corresponding block of source pixels from the video frame 202. A selected mode 222 may then be determined for the current block 210 based on a comparison of the costs 220A-M. An intermediate pixel generator 224 may generate an intermediate pixel block 204 for the current block 210. The intermediate pixel block 204 may be added to the video frame 202 at the location of the current block 210.

The sequential processing may continue with the next block 230 (e.g., the block to the right of the current block 210), as shown by a second target region indicator 226 and a second enlarged target region 228. During processing of the next block 230, a second set of reference pixels 232 may be selected from the generated intermediate pixels of the blocks neighboring the next block 230. For example, a part of the intermediate pixel block 204, created during the processing of the current block 210, may be used as part of the second set of reference pixels 232. An intermediate pixel block may be generated for the next block 230 in a manner similar to that described above. This process may continue until each block of the first size in the video frame 202 has a corresponding intermediate pixel block.

FIG. 2B is a schematic diagram depicting operations of another possible sequential processing 250 of a codec system used for efficient encoding operations, in accordance with at least some embodiments. In some embodiments, the codec system may be the video encoder 105. The sequential processing 250 may be used to generate intermediate pixels for use in a subsequent parallel processing in a manner similar to that of the sequential processing 200. As depicted, the sequential processing 250 may also use a reference frame 282, a reference block N 284, and an inter mode 280. The video frame 202 may be partitioned into blocks of a first size (e.g., 16×16 pixels). A first target region indicator 206 shows a current block 210 (block N) being processed and parts of the blocks that neighbor the current block 210. Next to the video frame 202 is a first enlarged target region 208. The blocks above and to the left of the current block 210 in the video frame 202 may have already been sequentially processed and a corresponding block of intermediate pixels may have been generated, as shown by the line-shaded blocks in the video frame 202.

During processing of the current block in the sequential processing 250, a first set of reference pixels 212 may be selected from the generated intermediate pixels of the blocks neighboring the current block 210. Specifically, the first set of reference pixels 212 may be selected from the generated intermediate pixel blocks to the left, to the top, and to the top-left of the current block 210. Additionally, a reference block 284 (reference block N) may be selected from the generated intermediate pixels of the reference frame 282. A third target region indicator 286 shows the reference block 284 in the reference frame 282. Under the reference frame 282 is a third enlarged target region 288, showing the reference block 284. The set of reference pixels 212 may be combined with each mode 214A-M of a plurality of modes to create predicted blocks 216A-M. Reference block 284 may also be combined with inter mode 280 to create predicted block 290. Each of the predicted blocks 216A-M and predicted block 290 may then be processed using a cost function 218 to determine a cost 220A-M and 292 for each of the predicted blocks 216A-M and predicted block 290, respectively. The cost function 218 may compare the predicted block to the corresponding block of source pixels from the video frame 202. A selected mode 294 may then be determined for the current block 210 based on a comparison of the costs 220A-M and 292. An intermediate pixel block may be generated by the intermediate pixel generator 224 for the current block 210 using the selected mode 294 and the reference block 284.

In another embodiment, the initial sequential processing may divide the video frame into blocks of a first size and select, as intermediate pixels for each block, a corresponding block of source pixels from the video frame.

After each block of the video frame has a corresponding intermediate pixel block (e.g., after the initial sequential processing), the codec system may continue with the parallel processing. The codec system may divide the video frame into blocks of a second size, blocks of a third size, and so on. Then, the codec system may process each block in parallel in a manner similar to the initial sequential processing. In some embodiments, instead of using the values of the neighboring block in the parallel processing to calculate the predicted blocks, the values of the neighboring blocks from the generated intermediate blocks are used. This eliminates the dependency between the current block and the previous block, allowing the codec system to process blocks in parallel. For example, the codec system may begin processing blocks of the second size and blocks of the third size at the top of the video frame using a first thread and may simultaneously begin processing blocks of the second size and blocks of the third size at the bottom of the video frame using a second thread.

In some embodiments, one difference between the initial sequential processing and the parallel processing is that for each block in the parallel processing, a prediction size and a prediction mode are selected but an intermediate pixel block is not generated. The generation of the prediction block using the prediction size and prediction mode selected during the parallel processing is postponed until the final sequential processing.

The final sequential processing may be performed similarly to the initial sequential processing. In some embodiments, instead of partitioning the video frame into blocks of the same size, the video frame is partitioned into blocks based on the selected prediction size for each block. Then, block-by-block, the codec system generates a final predicted block using the selected prediction mode for the block and pixel values from the neighboring, previously-processed final predicted blocks. The cost for each block is not calculated during the final sequential processing. Once the final predicted block is created, the residual is calculated, as described above, and the codec system creates a representation of the video frame (e.g., the image) by encoding the residual, the prediction mode, and the prediction size in the output bitstream.

FIG. 3A is a flow diagram of an example method 300 of parallel processing of a video frame during video encoding for efficient encoding operations, in accordance with at least some embodiments. In some embodiments, method 300 may be performed by the video encoder 105 of FIG. 1 . In some embodiments, method 300 may be performed by a dedicated codec accelerator (e.g., a co-processor) that communicates with one or more memory devices. In some embodiments, method 300 may be performed by a general-purpose processor (e.g., a central processing unit or a graphics processing unit). In some embodiments, at least some operations of method 300 may be performed by multiple (e.g., parallel) threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In some embodiments, processing threads implementing method 300 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Alternatively, threads implementing method 300 may be executed asynchronously with respect to each other. Various operations of method 300 may be performed in a different order compared with the order shown in FIG. 3A. Some operations of method 300 may be performed concurrently with other operations. In some embodiments, one or more operations shown in FIG. 3A are not performed.

The description of method 300 below refers, for brevity and conciseness, to an image. It should be understood that, in some embodiments, an image could be a video frame, such as a frame of a sequence of frames of a motion picture, a video advertisement, a video game, or any other video file (including a synthetic video file) produced by a video camera or any suitable video application. In another embodiment, an image can be an individual image (including a synthetic image), such as a still image, an image produced by a photo camera, a scanner, a graphics application, etc., or any other suitable image that is being compressed.

At block 310, processing logic performing method 300 may determine intermediate pixels (e.g., intermediate pixels 204 of FIG. 2A). In one embodiment, the intermediate pixels may be the result of the initial sequential processing described above in conjunction with FIG. 2A. For example, intermediate pixels may be determined using method 370 illustrated in FIG. 3B below. In another embodiment, the intermediate pixels may be pixels of the source video frame.

At block 320, processing logic may associate each location of the image with a block of a plurality of blocks of a first size and a block a plurality of blocks of a second size. In some embodiments, each location may be further associated with blocks of a third, fourth, etc., size. The first block size and the second block size (as well as blocks of other sizes) may each be a block size defined by a standardized video codec, such as AV1. For example, each superblock of 64×64 pixels may be split into blocks of a first size (32×32 pixels), second size (16×8 pixels), third size (8×8 pixels), fourth size (32×16 pixels), and so on.

At block 330, processing logic may determine, in parallel, using the intermediate pixels, for each block of the first size and for each block of the second size (and blocks of other sizes), a first cost for a first mode and a second cost for a second mode. The processing logic may further determine additional costs for additional modes (e.g., third/fourth/etc., cost for third/fourth/etc. mode), e.g., as illustrated in FIG. 2B in relation to modes 214A-M and costs 220A-M. Block 330 may be performed as part of the parallel processing. In some instances, the first mode and the second mode may be an intra-prediction mode and an inter-prediction mode, respectively, and the cost for each mode may be calculated by the cost function module 110. For example, the first mode may be intra-prediction mode 214A (associated with cost 220A) and the second mode may be inter-prediction mode 280 (associated with cost 292). In another example, the first mode and the second mode may both be intra-prediction modes. In some embodiments, for each block of a given size (first/second/etc.) a respective cost may be determined for all or at least a subset of modes recognized by the codec standard.

In some embodiments, as depicted by the upper callout portion in FIG. 3A, at block 332, for each of the first mode and the second mode of block 330, processing logic may generate a temporary block prediction based on a respective mode and a set of intermediate pixels. As a result, the temporary block predictions may be generated for each block of a given size.

At block 334, for each of the first mode and the second mode of block 330, processing logic may calculate a cost of the respective mode based on a comparison of the temporary block prediction and a corresponding block of source pixels of the image. More specifically, for each block of a given size, multiple temporary block predictions may be obtained, each prediction associated with a respective cost.

At block 340, processing logic may select, for each location of the image, using the first cost and the second cost for each of a respective block of the first size and a respective block of the second size associated with a corresponding location: a final mode, from at least the first mode and the second mode; and a final block size, from at least the first size and the second size. For example, processing logic may determine how each 64×64 pixel superblock is to be partitioned into smaller blocks and what modes are to be used for representation of source pixels of the respective blocks, e.g., based on the costs calculated for each block/mode combination. For example, a cost of representing the entire top-left square 32×32 pixel block using the inter-prediction mode may be compared to a cost of representing the same square 32×32 pixel block by further splitting it into two rectangular 32×16 pixel blocks with the top rectangular 32×16 pixel block represented using a horizontal intra-prediction mode and the bottom rectangular 32×16 pixel block represented using an oblique angle prediction mode.

At block 350, processing logic may determine final pixels based on the selected final mode and the selected final block size for each location of the image. In some embodiments, as depicted by the lower callout portion in FIG. 3A, at block 352, processing logic may, for each location of the image, generate an initial predicted block based on the selected final mode, the selected final block size, and a set of previously determined final pixels associated with one or more neighbor locations. For example, the initial predicted block may be a winner block selected, based on the cost functions, from temporary block predictions.

At block 354, processing logic may, for each location of the image, derive a final pixel block by transforming the initial predicted block using a compression algorithm. For example, the compression module 111 may determine a residual block for each selected winner block, transform the residual block using one of discrete transforms recognized by the codec standard (e.g., a discrete Fourier transform), quantize the transformed block, and perform an inverse discrete transform to obtain the final pixel block. Processing logic may further determine parameters of various filters that may be applied to the final pixel block, to improve visual quality of the block and remove various artifacts of block reconstruction. For example, a deblocking filter may remove visible block boundaries between neighboring blocks, a constrained directional enhancement filter may remove artifacts in the depictions of sharp edges, a loop restoration filter may reduce noise and improve edge quality, and so on.

At block 360, processing logic may obtain, based on the final pixels, a representation of the image. For example, the representation of the image may be the encoded output bitstream of the image that includes identification of the selected block sizes for various portions of the image, selected modes for each block, representations of residual blocks, parameters of filters selected for various blocks, and the like.

FIG. 3B is a flow diagram of an example method 370 of determining intermediate pixels for use in parallel processing of a video frame during video encoding for efficient encoding operations, in accordance with at least some embodiments. In an embodiment, the method 370 may be performed as part of block 310. Method 370 may correspond to the initial sequential processing discussed above in conjunction with FIG. 2A and may be performed by the video encoder 105 of FIG. 1 .

At block 312, processing logic may partition the image into a plurality of blocks of a pre-determined size, herein referred to as the third size. For example, the image may be partitioned into blocks of size 16×16 pixels, 32×32 pixels, 8×8 pixels or blocks of any other size (including non-square block sizes, e.g., 16×8 pixels).

At block 314, processing logic may process, sequentially, each block of the third size, to determine a third cost for the first mode and a fourth cost for the second mode, wherein determining the third cost and the fourth cost uses a set of intermediate pixels obtained for a previously processed block. In an embodiment, the first mode and the second mode may be an intra-prediction mode and an inter-prediction mode, respectively, and the cost for each mode may be calculated by the cost function module 110. In another embodiment, the first mode and the second mode may both be intra-prediction modes. At block 316, processing logic may select, for each block of the third size, an intermediate mode based on a comparison of the third cost for the first mode and the fourth cost for the second mode. At block 318, processing logic may obtain, using the selected intermediate mode, a set of intermediate pixels for a corresponding block of the third size.

FIG. 4 illustrates an example machine in the form of a computer system 400. The computer system 400 executes one or more sets of instructions 426 that cause the machine to perform any one or more of the methodologies discussed herein. The machine may operate in the capacity of a server or a client machine in a client-server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment. The machine may be a personal computer (PC), a tablet PC, a set-top box (STB), a personal digital assistant (PDA), a mobile telephone, a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine. Further, while only a single machine is illustrated, the term “machine” shall also be taken to include any collection of machines that individually or jointly execute the sets of instructions 426 to perform any one or more of the methodologies discussed herein.

The computer system 400 includes a processor 402, a main memory 404 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM) or Rambus DRAM (RDRAM), etc.), a static memory 406 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 416, which communicate with each other via a bus 408.

The processor 402 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processor 402 may be a complex instruction set computing (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, or a processor implementing other instruction sets or processors implementing a combination of instruction sets. The processor 402 may also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. The processor 402 is configured to execute instructions of the network node for performing the operations and steps discussed herein.

The computer system 400 may further include a network interface device 422 that provides communication with other machines over a network 418, such as a local area network (LAN), an intranet, an extranet, or the Internet. The computer system 400 also may include a display device 410 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 412 (e.g., a keyboard), a cursor control device 414 (e.g., a mouse), and a signal generation device 420 (e.g., a speaker).

The data storage device 416 may include a computer-readable storage medium 424 on which is stored the sets of instructions 426 of the network node embodying any one or more of the methodologies or functions described herein. The sets of instructions 426 of the network node may also reside, completely or at least partially, within the main memory 404 and/or within the processor 402 during execution thereof by the computer system 400, the main memory 404 and the processor 402 also constituting computer-readable storage media. The sets of instructions 426 may further be transmitted or received over the network 418 via the network interface device 422.

While the example of the computer-readable storage medium 424 is shown as a single medium, the term “computer-readable storage medium” can include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the sets of instructions 426. The term “computer-readable storage medium” can include any medium that is capable of storing, encoding or carrying a set of instructions for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present disclosure. The term “computer-readable storage medium” can include, but not be limited to, solid-state memories, optical media, and magnetic media.

Images and videos generated applying one or more of the techniques disclosed herein may be displayed on a monitor or other display device. In some embodiments, the display device may be coupled directly to the system or processor generating or rendering the images or videos. In other embodiments, the display device may be coupled indirectly to the system or processor such as via a network. Examples of such networks include the Internet, mobile telecommunications networks, a WIFI network, as well as any other wired and/or wireless networking system. When the display device is indirectly coupled, the images or videos generated by the system or processor may be streamed over the network to the display device. Such streaming allows, for example, video games or other applications, which render images or videos, to be executed on a server or in a data center and the rendered images and videos to be transmitted and displayed on one or more user devices (such as a computer, video game console, smartphone, other mobile device, etc.) that are physically separate from the server or data center. Hence, the techniques disclosed herein can be applied to enhance the images or videos that are streamed and to enhance services that stream images and videos such as NVIDIA GeForce Now (GFN), Google Stadia, and the like.

Furthermore, images and videos generated applying one or more of the techniques disclosed herein may be used to train, test, or certify deep neural networks (DNNs) used to recognize objects and environments in the real world. Such images and videos may include scenes of roadways, factories, buildings, urban settings, rural settings, humans, animals, and any other physical object or real-world setting. Such images and videos may be used to train, test, or certify DNNs that are employed in machines or robots to manipulate, handle, or modify physical objects in the real world. Furthermore, such images and videos may be used to train, test, or certify DNNs that are employed in autonomous vehicles to navigate and move the vehicles through the real world. Additionally, images and videos generated applying one or more of the techniques disclosed herein may be used to convey information to users of such machines, robots, and vehicles.

Other variations are within spirit of present disclosure. Thus, while disclosed techniques are susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in drawings and have been described above in detail. It should be understood, however, that there is no intention to limit disclosure to specific form or forms disclosed, but on contrary, intention is to cover all modifications, alternative constructions, and equivalents falling within spirit and scope of disclosure, as defined in appended claims.

Use of terms “a” and “an” and “the” and similar referents in context of describing disclosed embodiments (especially in context of following claims) are to be construed to cover both singular and plural, unless otherwise indicated herein or clearly contradicted by context, and not as a definition of a term. Terms “comprising,” “having,” “including,” and “containing” are to be construed as open-ended terms (meaning “including, but not limited to,”) unless otherwise noted. “Connected,” when unmodified and referring to physical connections, is to be construed as partly or wholly contained within, attached to, or joined together, even if there is something intervening. Recitation of ranges of values herein are merely intended to serve as a shorthand method of referring individually to each separate value falling within range, unless otherwise indicated herein and each separate value is incorporated into specification as if it were individually recited herein. In at least one embodiment, use of term “set” (e.g., “a set of items”) or “subset” unless otherwise noted or contradicted by context, is to be construed as a nonempty collection comprising one or more members. Further, unless otherwise noted or contradicted by context, term “subset” of a corresponding set does not necessarily denote a proper subset of corresponding set, but subset and corresponding set may be equal.

Conjunctive language, such as phrases of form “at least one of A, B, and C,” or “at least one of A, B and C,” unless specifically stated otherwise or otherwise clearly contradicted by context, is otherwise understood with context as used in general to present that an item, term, etc., may be either A or B or C, or any nonempty subset of set of A and B and C. For instance, in illustrative example of a set having three members, conjunctive phrases “at least one of A, B, and C” and “at least one of A, B and C” refer to any of following sets: {A}, {B}, {C}, {A, B}, {A, C}, {B, C}, {A, B, C}. Thus, such conjunctive language is not generally intended to imply that certain embodiments require at least one of A, at least one of B and at least one of C each to be present. In addition, unless otherwise noted or contradicted by context, term “plurality” indicates a state of being plural (e.g., “a plurality of items” indicates multiple items). In at least one embodiment, number of items in a plurality is at least two, but can be more when so indicated either explicitly or by context. Further, unless stated otherwise or otherwise clear from context, phrase “based on” means “based at least in part on” and not “based solely on.”

Operations of processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. In at least one embodiment, a process such as those processes described herein (or variations and/or combinations thereof) is performed under control of one or more computer systems configured with executable instructions and is implemented as code (e.g., executable instructions, one or more computer programs or one or more applications) executing collectively on one or more processors, by hardware or combinations thereof. In at least one embodiment, code is stored on a computer-readable storage medium, for example, in form of a computer program comprising a plurality of instructions executable by one or more processors. In at least one embodiment, a computer-readable storage medium is a non-transitory computer-readable storage medium that excludes transitory signals (e.g., a propagating transient electric or electromagnetic transmission) but includes non-transitory data storage circuitry (e.g., buffers, cache, and queues) within transceivers of transitory signals. In at least one embodiment, code (e.g., executable code or source code) is stored on a set of one or more non-transitory computer-readable storage media having stored thereon executable instructions (or other memory to store executable instructions) that, when executed (i.e., as a result of being executed) by one or more processors of a computer system, cause computer system to perform operations described herein. In at least one embodiment, set of non-transitory computer-readable storage media comprises multiple non-transitory computer-readable storage media and one or more of individual non-transitory storage media of multiple non-transitory computer-readable storage media lack all of code while multiple non-transitory computer-readable storage media collectively store all of code. In at least one embodiment, executable instructions are executed such that different instructions are executed by different processors—for example, a non-transitory computer-readable storage medium store instructions and a main central processing unit (“CPU”) executes some of instructions while a graphics processing unit (“GPU”) executes other instructions. In at least one embodiment, different components of a computer system have separate processors and different processors execute different subsets of instructions.

Accordingly, in at least one embodiment, computer systems are configured to implement one or more services that singly or collectively perform operations of processes described herein and such computer systems are configured with applicable hardware and/or software that enable performance of operations. Further, a computer system that implements at least one embodiment of present disclosure is a single device and, in another embodiment, is a distributed computer system comprising multiple devices that operate differently such that distributed computer system performs operations described herein and such that a single device does not perform all operations.

Use of any and all examples, or exemplary language (e.g., “such as”) provided herein, is intended merely to better illuminate embodiments of disclosure and does not pose a limitation on scope of disclosure unless otherwise claimed. No language in specification should be construed as indicating any non-claimed element as essential to practice of disclosure.

All references, including publications, patent applications, and patents, cited herein are hereby incorporated by reference to same extent as if each reference were individually and specifically indicated to be incorporated by reference and were set forth in its entirety herein.

In description and claims, terms “coupled” and “connected,” along with their derivatives, may be used. It should be understood that these terms may be not intended as synonyms for each other. Rather, in particular examples, “connected” or “coupled” may be used to indicate that two or more elements are in direct or indirect physical or electrical contact with each other. “Coupled” may also mean that two or more elements are not in direct contact with each other, but yet still co-operate or interact with each other.

Unless specifically stated otherwise, it may be appreciated that throughout specification terms such as “processing,” “computing,” “calculating,” “determining,” or like, refer to action and/or processes of a computer or computing system, or similar electronic computing device, that manipulate and/or transform data represented as physical, such as electronic, quantities within computing system's registers and/or memories into other data similarly represented as physical quantities within computing system's memories, registers or other such information storage, transmission or display devices.

In a similar manner, term “processor” may refer to any device or portion of a device that processes electronic data from registers and/or memory and transform that electronic data into other electronic data that may be stored in registers and/or memory. As non-limiting examples, “processor” may be a CPU or a GPU. A “computing platform” may comprise one or more processors. As used herein, “software” processes may include, for example, software and/or hardware entities that perform work over time, such as tasks, threads, and intelligent agents. Also, each process may refer to multiple processes, for carrying out instructions in sequence or in parallel, continuously or intermittently. In at least one embodiment, terms “system” and “method” are used herein interchangeably insofar as system may embody one or more methods and methods may be considered a system.

In present document, references may be made to obtaining, acquiring, receiving, or inputting analog or digital data into a subsystem, computer system, or computer-implemented machine. In at least one embodiment, process of obtaining, acquiring, receiving, or inputting analog and digital data can be accomplished in a variety of ways such as by receiving data as a parameter of a function call or a call to an application programming interface. In at least one embodiment, processes of obtaining, acquiring, receiving, or inputting analog or digital data can be accomplished by transferring data via a serial or parallel interface. In at least one embodiment, processes of obtaining, acquiring, receiving, or inputting analog or digital data can be accomplished by transferring data via a computer network from providing entity to acquiring entity. In at least one embodiment, references may also be made to providing, outputting, transmitting, sending, or presenting analog or digital data. In various examples, processes of providing, outputting, transmitting, sending, or presenting analog or digital data can be accomplished by transferring data as an input or output parameter of a function call, a parameter of an application programming interface or interprocess communication mechanism.

Although descriptions herein set forth example embodiments of described techniques, other architectures may be used to implement described functionality, and are intended to be within scope of this disclosure. Furthermore, although specific distributions of responsibilities may be defined above for purposes of description, various functions and responsibilities might be distributed and divided in different ways, depending on circumstances.

Furthermore, although subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that subject matter claimed in appended claims is not necessarily limited to specific features or acts described. Rather, specific features and acts are disclosed as exemplary forms of implementing the claims. 

What is claimed is:
 1. A method for compressing data of an image, the method comprising: determining intermediate pixels; associating each location of the image with a block of a plurality of blocks of a first size and a block a plurality of blocks of a second size; determining, in parallel, using the intermediate pixels, for each block of the first size and for each block of the second size, a first cost for a first mode and a second cost for a second mode; selecting, for each location of the image, i) a final mode from at least the first mode and the second mode and ii) a final block size from at least the first size and the second size, using the first cost and the second cost for each of a respective block of the first size and a respective block of the second size associated with a corresponding location; determining final pixels based on the selected final mode and the selected final block size for each location of the image; and obtaining, based on the final pixels, a representation of the image.
 2. The method of claim 1, wherein determining the intermediate pixels comprises: partitioning the image into a plurality of blocks of a third size; processing, sequentially, each block of the third size, to determine a third cost for the first mode and a fourth cost for the second mode, wherein determining the third cost and the fourth cost uses a set of intermediate pixels obtained for a previously processed block; selecting, for each block of the third size, an intermediate mode based on a comparison of the third cost for the first mode and the fourth cost for the second mode; and obtaining, using the selected intermediate mode, a set of intermediate pixels for a corresponding block of the third size.
 3. The method of claim 1, wherein determining the intermediate pixels comprises: partitioning the image into a plurality of blocks of a third size; and selecting, for each of the blocks of the third size, a corresponding block of source pixels from the image.
 4. The method of claim 1, wherein determining the first cost for the first mode and the second cost for the second mode comprises, for each of the first mode and the second mode: generating a temporary block prediction based on a respective mode and a set of intermediate pixels; and calculating a cost of the respective mode based on a comparison of the temporary block prediction and a corresponding block of source pixels of the image.
 5. The method of claim 1, wherein determining the final pixels comprises, for each location of the image: generating an initial predicted block based on the selected final mode, the selected final block size, and a set of previously determined final pixels associated with one or more neighbor locations; and deriving a final pixel block by transforming the initial predicted block using a compression algorithm.
 6. The method of claim 5, wherein the compression algorithm is based on one of AV1, HEVC, VVC, or VP9 encoding standards.
 7. The method of claim 1, wherein the first mode is one of a plurality of intra-prediction modes and the second mode is an inter-prediction mode.
 8. The method of claim 7, wherein the inter-prediction mode approximates: the respective block of the first size with a first reference block of the first size in a first reference image; and the respective block of the second size with a second reference block of the second size in a second reference image.
 9. A system comprising: a memory; and a processor, coupled to the memory, to perform operations comprising: determining intermediate pixels for an image; associating each location of the image with a block of a plurality of blocks of a first size and a block a plurality of blocks of a second size; determining, in parallel, using the intermediate pixels, for each block of the first size and for each block of the second size, a first cost for a first mode and a second cost for a second mode; selecting, for each location of the image, i) a final mode from at least the first mode and the second mode and ii) a final block size from at least the first size and the second size, using the first cost and the second cost for each of a respective block of the first size and a respective block of the second size associated with a corresponding location; determining final pixels based on the selected final mode and the selected final block size for each location of the image; and obtaining, based on the final pixels, a representation of the image.
 10. The system of claim 9, wherein determining the intermediate pixels comprises: partitioning the image into a plurality of blocks of a third size; processing, sequentially, each block of the third size, to determine a third cost for the first mode and a fourth cost for the second mode, wherein determining the third cost and the fourth cost uses a set of intermediate pixels obtained for a previously processed block; selecting, for each block of the third size, an intermediate mode based on a comparison of the third cost for the first mode and the fourth cost for the second mode; and obtaining, using the selected intermediate mode, a set of intermediate pixels for a corresponding block of the third size.
 11. The system of claim 9, wherein determining the first cost for the first mode and the second cost for the second mode comprises, for each of the first mode and the second mode: generating a temporary block prediction based on a respective mode and a set of intermediate pixels; and calculating a cost of the respective mode based on a comparison of the temporary block prediction and a corresponding block of source pixels of the image.
 12. The system of claim 9, wherein determining the final pixels comprises, for each location of the image: generating an initial predicted block based on the selected final mode, the selected final block size, and a set of previously determined final pixels associated with one or more neighbor locations; and deriving a final pixel block by transforming the initial predicted block using a compression algorithm.
 13. The system of claim 12, wherein the compression algorithm is based on one of AV1, HEVC, VVC, or VP9 encoding standards.
 14. The system of claim 9, wherein the first mode is one of a plurality of intra-prediction modes and the second mode is an inter-prediction mode.
 15. A non-transitory computer-readable medium comprising instructions, which when executed by a processor cause the processor to perform operations comprising: determining intermediate pixels for an image; associating each location of the image with a block of a plurality of blocks of a first size and a block a plurality of blocks of a second size; determining, in parallel, using the intermediate pixels, for each block of the first size and for each block of the second size, a first cost for a first mode and a second cost for a second mode; selecting, for each location of the image, i) a final mode from at least the first mode and the second mode and ii) a final block size from at least the first size and the second size, using the first cost and the second cost for each of a respective block of the first size and a respective block of the second size associated with a corresponding location; determining final pixels based on the selected final mode and the selected final block size for each location of the image; and obtaining, based on the final pixels, a representation of the image.
 16. The non-transitory computer-readable medium of claim 15, wherein determining the intermediate pixels comprises: partitioning the image into a plurality of blocks of a third size; processing, sequentially, each block of the third size, to determine a third cost for the first mode and a fourth cost for the second mode, wherein determining the third cost and the fourth cost uses a set of intermediate pixels obtained for a previously processed block; selecting, for each block of the third size, an intermediate mode based on a comparison of the third cost for the first mode and the fourth cost for the second mode; and obtaining, using the selected intermediate mode, a set of intermediate pixels for a corresponding block of the third size.
 17. The non-transitory computer-readable medium of claim 15, wherein determining the first cost for the first mode and the second cost for the second mode comprises, for each of the first mode and the second mode: generating a temporary block prediction based on a respective mode and a set of intermediate pixels; and calculating a cost of the respective mode based on a comparison of the temporary block prediction and a corresponding block of source pixels of the image.
 18. The non-transitory computer-readable medium of claim 15, wherein determining the final pixels comprises, for each location of the image: generating an initial predicted block based on the selected final mode, the selected final block size, and a set of previously determined final pixels associated with one or more neighbor locations; and deriving a final pixel block by transforming the initial predicted block using a compression algorithm.
 19. The non-transitory computer-readable medium of claim 18, wherein the compression algorithm is based on one of AV1, HEVC, VVC, or VP9 encoding standards.
 20. The non-transitory computer-readable medium of claim 15, wherein the first mode is one of a plurality of intra-prediction modes and the second mode is an inter-prediction mode. 